﻿using ClientBankWPF.Service;

namespace ClientBankWPF
{
    class Generators
    {
        private readonly DataAccessService dataAccessService;

        public Generators(DataAccessService dataAccessService)
        {
            this.dataAccessService = dataAccessService;
        }

        public decimal UNPGenerator()
        {
            decimal? maxUNP = dataAccessService.GetMaxUNP();
            if (maxUNP == null)
            {
                return 100000001;
            }
            maxUNP++;
            return (decimal)maxUNP;
        }

        public decimal DepositNumberGenetrator()
        {
            decimal? maxDepNumber = dataAccessService.GetMaxDepositNumber();
            if (maxDepNumber == null)
            {
                return 1000000000001;
            }
            maxDepNumber++;
            return (decimal)maxDepNumber;
        }

        public decimal BankCodeGenerator()
        {
            decimal? maxCode = dataAccessService.GetMaxBankCode();
            if (maxCode == null)
            {
                return 101;
            }
            maxCode++;
            return (decimal)maxCode;
        }
    }
}